using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebFoundation.Data;
using MHI.InspectionManager.Interfaces; 

namespace MHI.InspectionManager.Data
{
	/// <summary>
	/// DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t 
	/// </summary>
	internal class DevPlaninspectionpointTWritingDAO : WritableDAO<DevPlaninspectionpointT> 
	{
		protected static DbManager _dbManager = DbManager.FromConfig("DefaultConnection");

		public DevPlaninspectionpointTWritingDAO()
		: base(_dbManager)
		{
		}

		public DevPlaninspectionpointTWritingDAO(DbManager db)
		: base(db)
		{
			_dbManager = db;
		}

		/// <summary>
		/// 增加一行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool AddDevPlaninspectionpointT(DevPlaninspectionpointT item)
		{
			this.Add(item);
			return true;
		}

		/// <summary>
		/// 增加多行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool AddDevPlaninspectionpointTs(DevPlaninspectionpointT[] items)
		{
			this.Add(items);
			return true;
		}

		/// <summary>
		/// 更新一行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool UpdateDevPlaninspectionpointT(DevPlaninspectionpointT item)
		{
			bool bOK = this.Update(item);
			return bOK;
		}

		/// <summary>
		///  更新多行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool UpdateDevPlaninspectionpointTs(DevPlaninspectionpointT[] items)
		{
			bool bOK = this.Update(items);
			return bOK;
		}

		/// <summary>
		/// 删除一行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevPlaninspectionpointT(DevPlaninspectionpointT item)
		{
			bool bOK = this.Delete(item);
			return bOK;
		}

		/// <summary>
		///  删除多行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevPlaninspectionpointTs(DevPlaninspectionpointT[] items)
		{
			bool bOK = this.Delete(items);
			return bOK;
		}

		/// <summary>
		///  根据ids，删除多行DevPlaninspectionpointT,table entity:dev_planinspectionpoint_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevPlaninspectionpointTByIds(int[] ids)
		{
			for (int i = 0; i < ids.Length; i++)
			{
				DynamicalBatchExcutor<DevPlaninspectionpointT> excutor = new DynamicalBatchExcutor<DevPlaninspectionpointT>(this.DBManager);
				excutor.Query().Filter().Eq(r => r.Id, ids[i]);
				excutor.BatchDelete(this.Transaction, _TimeOut);
			}
			return true;
		}

	}
}
